import request from '@/utils/request'
const api_name = '/course'

export default {
    //分页查询课程列表
    getList(page, limit, searchObj) {
        return request({
            url: `http://39.98.120.230:8080/api/course/list/${page}/${limit}`,
            method: 'post',
            data: searchObj
        })
    },
    //根据id删除课程
    deleteCourseById(id) {
        return request({
            url: `http://39.98.120.230:8080/api/course/${id}`,
            method: 'delete',
        })
    },
    //添加课程基本信息
    addCourse(course) {
        return request({
            url: `http://39.98.120.230:8080/api/course`,
            method: 'post',
            data: course
        })
    },
    //根据id获取课程基本信息
    getCourseInfoById(id) {
        return request({
            url: `http://39.98.120.230:8080/api/course/${id}`,
            method: 'get'
        })
    },
    //更新课程基本信息
    updatedCourse(course) {
        return request({
            url: `http://39.98.120.230:8080/api/course/${course.id}`,
            method: 'put',
            data: course
        })
    },
    //根据id获取最终发布的信息
    getPbulishInfoById(id) {
        return request({
            url: `http://39.98.120.230:8080/api/course/publishinfo/${id}`,
            method: 'get'
        })
    },
    publishCourse(id) {
        return request({
            url: `http://39.98.120.230:8080/api/course/publish/${id}`,
            method: 'put',
        })
    }
}